﻿// Decompiled with JetBrains decompiler
// Type: System.Web.Razor.Generator.BaseCodeWriter
// Assembly: System.Web.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
// MVID: 682513D6-F37E-48AC-9909-F3EE103CFF14
// Assembly location: D:\Project\Idea\无人机外网\uav\客户端工程\排查工具\bin\Release\System.Web.Razor.dll

namespace System.Web.Razor.Generator
{
  internal abstract class BaseCodeWriter : CodeWriter
  {
    public override void WriteSnippet(string snippet) => this.InnerWriter.Write(snippet);

    protected internal override void EmitStartMethodInvoke(string methodName) => this.EmitStartMethodInvoke(methodName, new string[0]);

    protected internal override void EmitStartMethodInvoke(
      string methodName,
      params string[] genericArguments)
    {
      this.InnerWriter.Write(methodName);
      if (genericArguments != null && genericArguments.Length != 0)
      {
        this.WriteStartGenerics();
        for (int index = 0; index < genericArguments.Length; ++index)
        {
          if (index > 0)
            this.WriteParameterSeparator();
          this.WriteSnippet(genericArguments[index]);
        }
        this.WriteEndGenerics();
      }
      this.InnerWriter.Write("(");
    }

    protected internal override void EmitEndMethodInvoke() => this.InnerWriter.Write(")");

    protected internal override void EmitEndConstructor() => this.InnerWriter.Write(")");

    protected internal override void EmitEndLambdaExpression()
    {
    }

    public override void WriteParameterSeparator() => this.InnerWriter.Write(", ");

    protected internal void WriteCommaSeparatedList<T>(T[] items, Action<T> writeItemAction)
    {
      for (int index = 0; index < items.Length; ++index)
      {
        if (index > 0)
          this.InnerWriter.Write(", ");
        writeItemAction(items[index]);
      }
    }

    protected internal virtual void WriteStartGenerics()
    {
    }

    protected internal virtual void WriteEndGenerics()
    {
    }
  }
}
